#include <iostream>
#include <string>
#include "Monitor.h"

using namespace std;


Monitor::Monitor(string ID, int size, string Brand, int stock, int price):Product(ID, Brand, stock, price){
	this->size = size;
}

map <int, string> Monitor::getHeader(){
	map <int, string> result;
	result[0] = "ID";
	result[1] = "Size";
	result[2] = "Brand";
	result[3] = "Stock";
	result[4] = "Price";
	return result;
}

map <int, int> Monitor::getHeaderLength(){
	map <int, int> result;
	result[0] = 10;
	result[1] = 6;
	result[2] = 15;
	result[3] = 7;
	result[4] = 7;
	return result;
}

map <int, string> Monitor::getAllData(){
	map <int, string> result;
	result[0] = id;
	result[1] = int2str(size);
	result[2] = brand;
	result[3] = int2str(stock);
	result[4] = int2str(price);
	return result;
}

bool Monitor::isLarger(int compareFactor, Product *product2){
	Monitor *monitor = dynamic_cast < Monitor * >(product2);

	//remark: if(hardDisk != 0) is insert for safety reason. It won't be false under proper communication between classes

	switch (compareFactor){
	case 0:
		return !product2->Product::isLarger(compareFactor, this);
	case 1: //compare by size
		if(monitor != 0)
			return this->size > monitor->size;
	default: //call parent comparason
		return !product2->Product::isLarger(compareFactor-1, this);
	}
}